//
//  LzwStyleTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwStyleTableCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwStyleTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageStyle;
@property (nonatomic, retain) LzwBaseImageView *myImageStyle1;

@property (nonatomic, retain) LzwBaseLable *myLablestyle;
@property (nonatomic, retain) LzwBaseLable *myLablestyle1;



@end
@implementation LzwStyleTableCell

-(void)dealloc{
    [_myImageStyle release];
    [_myImageStyle1 release];
    [_myLablestyle release];
    [_myLablestyle1 release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatStylr];
    }
    return self;
}

- (void)creatStylr{
    
    //图片
    self.myImageStyle = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myImageStyle.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageStyle];
    
    //喜爱图片
    self.myImageStyle1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myImageStyle1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myImageStyle1];
    
    //描述
    self.myLablestyle = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLablestyle.textColor = [UIColor lightGrayColor];
    self.myLablestyle.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLablestyle.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLablestyle];
    
    //喜爱人数
    self.myLablestyle1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLablestyle1.textColor = [UIColor lightGrayColor];
    self.myLablestyle1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLablestyle1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLablestyle1];
    
    [_myImageStyle release];
    [_myImageStyle1 release];
    [_myLablestyle release];
    [_myLablestyle1 release];
    

    
}

-(void)setModleStyle:(LzwStyleModle *)modleStyle{
    
    if (_modleStyle != modleStyle) {
        [_modleStyle release];
        _modleStyle = [modleStyle retain];
    }
    
    self.myLablestyle.text = self.modleStyle.title;
    self.myLablestyle1.text = self.modleStyle.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleStyle.pic];
    
    [self.myImageStyle sd_setImageWithURL:url placeholderImage:nil];
    

    
    
}

@end
